﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using System.Globalization;

namespace Language_Editor
{
    //  Summary:
    //      ændrer sproget der oversættes til i hurtig oversæt funktionen
    public partial class Settings : Telerik.WinControls.UI.RadForm
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            PickLanguage pickLanguageWindow = new PickLanguage();
            CultureInfo ci = pickLanguageWindow.getNew();
            if (ci != null)
            {
                ConfigManager.Config.AppSettings.Settings[ConfigManager.PREFEREDLANGUAGE].Value = ci.Name;
                LblLanguageValue.Text = ci.Name;
            }
        }

        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);
            if (Visible)
                LblLanguageValue.Text = ConfigManager.Config.AppSettings.Settings[ConfigManager.PREFEREDLANGUAGE].Value;
        }

        private void radButton3_Click(object sender, EventArgs e)
        {
            ConfigManager.Config.Save();
            Dispose();
        }

        private void radButton2_Click(object sender, EventArgs e)
        {
            Dispose();
        }

        
    }
}
